<%-- 
    Document   : edit_post_db
    Created on : 2 Jun, 2012, 6:06:32 PM
    Author     : bharat
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html>
<%

    String usr_name = (String) session.getAttribute("usr");
    String pid_ = request.getParameter("pid");
    
    String type = request.getParameter("type");
    String subject = request.getParameter("subject");
    String post = request.getParameter("post");
    
    System.out.println(post);

    Connection con5 = null;
    PreparedStatement pstmt5 = null;


    try {
      //    con5.setAutoCommit(false);  
        Class.forName("oracle.jdbc.driver.OracleDriver");
        con5 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "aksh", "aksh");
        
        pstmt5 = con5.prepareStatement("update posts set type=?, subject=?, post=? where pid=?");
        pstmt5.setString(1, type);
        pstmt5.setString(2, subject);
        pstmt5.setString(3, post);
        pstmt5.setString(4, pid_);
        int n = pstmt5.executeUpdate();
        System.out.println("Updated "+n);
         //       con5.commit();
        response.sendRedirect(".acc");
    } catch (Exception e) {
        
        response.sendError(505, e.getMessage());
        e.printStackTrace();
    }

%>
